﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Input;

namespace MathTools {
    public struct Vector {
        double[] datas;
        public int Dimension { get; private set; }
        public Vector(params double[] datas) :this(){            
            if (datas != null) {
                this.datas = datas;
                this.Dimension = datas.Length;
            } else {
                this.datas = null;
                this.Dimension = 0;
            }
        }
        public double this[int i] {
            get { if (i >= 0 && i < this.Dimension)return this.datas[i]; throw new IndexOutOfRangeException("索引超出范围"); }
            set { if (i >= 0 && i < this.Dimension) this.datas[i] = value; throw new IndexOutOfRangeException("索引超出范围"); }
        }
    }
}
